Newbie on the block needs guidance

Hi All,

  I'm a brand new kid to DOORS but I was tasked to do the data synch between DOORS and external JIRA app.

  The story/problem goes like this:

1 -  In Jira,  I have high-level requirements X,  and low-level requirements Y.  One example of relationship between the high-level and low-level requirements as follows:

    X1 -> Y1

          -> Y2

          -> Y3

   X2  -> Y4

          -> Y5

          -> Y6

   etc....

2  - High-level requirements X do exist in DOOR.  What I try to do is:

       A - Import the low-level requirement Ys

       B - Create an in-link from parent X to Y

       C - Create an out-link from Y to X

In other words, I'd like to build a hierarchy relationship between parent X and child Y after I successfully import the data from Jira.

3 - My Import file extract from Jira looks  like this:

 

     Object Identifier     Object Text            Parent ID                  Parent Module Prefix    Child Module Prefix

                                     As Admin...etc         Parent_X1_1             Parent_X1_                     Child_Y1_

                                     As User...  etc         Parent_X2_1             Parent_X2_                     Child_Y2_

                                    As Auditor..etc         Parent_X3_1             Parent_X3_                     Child_Y3_

 

   Object Identifier ( of child Y)  = blank because I need DOOR to populate the child ID for  every child Y.

    When DOORS imports the child Requirements Ys, I want DOORs to put them in the right module base don child module prefix which comes with each child Y.

 I did spend sometime now to learn DXL but DXL is a domain-specific language and it has so many pre-defined key words that I think will take me sometime to get a hang of it. :-)

 Meanwhile I simply just want to write a simple DXL script to build two-way relationship between the parent and the child.  I think I provide enough info for DOORS to know what child belongs to what parent based on their module prefixes, but I do not know DXL well enough to write those instructions.

  What I need is a hint/tip where I need to read further on how to tell DOORS to build the relationship for the parents and their children?  It would be great help if you could throw in some code lines.  I'm technically capable to take up from there.

  Thanks a lot in advance for your help folks!

  Regards,

  John Nguyen

 

        

 

 

 


RFT_Newbie - Mon Jun 04 18:39:00 EDT 2018

Re: Newbie on the block needs guidance
Mathias Mamsch - Fri Jun 08 03:54:02 EDT 2018

You will be able to find code snippets for most of the tasks inside the forum, if you employ the search:

- how to read a file

- how to find an object

- how to create a link

etc.

If you can come up with some more specific problems, we will be happy to answer. Just a general "post me some code snippets to solve my problem" is not likely to work out. Regards, Mathias

Re: Newbie on the block needs guidance
Mike.Scharnow - Fri Jun 08 04:30:43 EDT 2018

and some other hint: you can think of DXL a bit like a "remote control" for DOORS, a DOORS automation. So, everything you do in DXL, you can also do in the GUI and vice versa, so you neeed to understand what you are doing in DOORS and only then can start writing a script.

 

So, I suggest that you start DOORS, do what you want to achieve using the GUI and in the meantime take note of every single step, of every click that you do (like: "first I navigate to project X, navigate to the folder Y, open the module Z in edit mode, I iterate over every object and for each object I look at attrbute A, compare it with value B .. […] ..... I don't forget to save, I close the module"

Usually, your DXL script will look exactly like what you did in the GUI. Also, you will see that the predefined keywords almost always describe some "thing" in DOORS.

 

Things might become complicated if your module is not yet set up for creating Links and you need to do this programatically (create link module, create link restriction, default link module, ...), but if you only have one specific module that you want to work with, you could set up this module manually and in your script rely on that everything has been prepared correctly.

 

 

One other remark:

I did not understand whether you want to work inside one module only or whether you want to have several modules (e.g. one for high level, one for low level). If everything is done in one module only, you might want to consider whether it is really the best idea to create links from lower to higher req, perhaps it is enough to create a structure like in MS Word: Outline level 1: High level, Objects X1, X2, X3, Level 2: low level req, Object Y1 is placed below (not after) X1, has the siblings Y2 and Y3, has the parent X1.

Re: Newbie on the block needs guidance
RFT_Newbie - Fri Jun 08 13:03:45 EDT 2018

Mathias Mamsch - Fri Jun 08 03:54:02 EDT 2018

You will be able to find code snippets for most of the tasks inside the forum, if you employ the search:

- how to read a file

- how to find an object

- how to create a link

etc.

If you can come up with some more specific problems, we will be happy to answer. Just a general "post me some code snippets to solve my problem" is not likely to work out. Regards, Mathias

Hi Mathias & Mike,

  Thanks a lot for taking time to answer my inquiry,

  Maybe I have not clearly described what I'm trying to do here but no, I do not need "post me some code snippets to solve my problem".  As I mentioned in my post heading, I need guidance/hints/tips of how to do what I am trying to do.  I also said if you guys can throw in a few sample lines of code - not for my problem - but for a general problem that can help to show how to, for example, to look up a module given that I already know the unique module prefix.  The code/pseudo-code can be :

   Read in all values from Jira file and assign each value to a variable

   Then

     for linkModule in all Module do

     {

        if (linkModule == "Parent_X1_") then

           createOutLink ("Child_Y1_ 10", "Parent_X1_86")

           createOutLink ("Parent_X1_86", "Child_Y1_ 10")

    }

    What I'm looking for is the specific function names such as "createLink (childOutLink, parentInLink))" and/or the specific keywords that can help me to do that task.  Or if that function does not exist, then what are the component pieces (atomic functions) I need to know in order to create my own.  This is what I am looking for.

   Since DOORS is a domain-specific language and I 'm new to DOORS as well, I need to know IF there are any methods, functions interfaces that DOORS provides that I can use to do that task?

  I did read through DOORS DXL doc and also created some sample code to see how it works and I can tell: DXL is one heck of a language -). It's a dead language.  It's so tied down to the structure of DOORS which use Object Database (not RDBMS).  If you're new to DXL - like me - it would take you a long time to get the hang of it.  The most challenging part of all is the scope of DXL.  The code will work ONLY if it is run/executed in the scope it intends to be in and it seems to me there are no  DXL functions that I can tell DXL that this is the scope I want it to execute in.

  I'm not lazy and just want to make a short cut or an easy way out.  I did study DXL doc - for 2 weeks - but I have not gained the full understanding the architecture of DOORS and that's where I need guidance/tips/hints so that I can understand it better.

  Anyway, to cut the chase, here is the problem I try to solve:

1 - DOORS has a parent module "Parent_X" that links to a child module "Child_Y_".

2 - In parent module "Parent_X", there are members "Parent_X__1", "Parent_X_2", ..., "Parent_X_n"

3 - "Parent_X_1" has two children "Child_Y_1" and "Child_Y_2"

      Example:

                   Parent_X_1 <-> Child_Y_1

                   Parent_X_1 <-> Child_Y_2

4 - Now have a  new child Y from Jira, in CSV format which contains child Y and  all the information about its parent X.  Note that this child does not already exist in DOORS and it needs DOORS to designate an ID (Object Identifier) for it.

   

     Object Identifier     Object Text            Parent ID                  Parent Module Prefix    Child Module Prefix

                                     As Admin...etc         Parent_X_1               Parent_X_                          Child_Y_

 

5 - I'd like to write a DOOR DXL program to:

     - Create a new child object Y where it belong to module "Child_Y"

    -  Once Doors create a new child Y, and designate a new Object Identifier, let say, "Child_Y_3" then

    - From "Child_Y_3', create an outlink to "Parent_X_1" where the parent's module is  "Parent_X_"

    - From "Parent_X_1", create an outlink to child "Child_Y_3" where the child's module is "Child_Y_"

6 - I'd like to initiate the  execution as mentioned above, when I select the CSV file for import.

 Question:  Given the modules relationship specified in the import file, is that possible to tell DXL to build those relationships/links by itself?  And how to kick off the DXL scripts at the import layer?  Or what is the best way to do this?

Thanks for the guidance/tips/hints.  Where in the DXL docs,  can I look up some methods that can help me to do just that?

Again, I'm technically capable to sort these out by myself.  I only need experienced folks like you guys to point me to the right directions.  That will save me a great deal of time to digest this crazy, ugly, obnoxious , domain-specific language.  In other words, please show me the water, I'll drink it myself.

  Thanks again for taking your time to respond to my inquiry and feel free correct me if my understanding of DXL is incorrect.  I'm all ears.  Please help!

  Regards,

  John Nguyen

    

 

 



 

 

 

 

 

 

Re: Newbie on the block needs guidance
Mike.Scharnow - Fri Jun 08 19:50:13 EDT 2018

RFT_Newbie - Fri Jun 08 13:03:45 EDT 2018

Hi Mathias & Mike,

  Thanks a lot for taking time to answer my inquiry,

  Maybe I have not clearly described what I'm trying to do here but no, I do not need "post me some code snippets to solve my problem".  As I mentioned in my post heading, I need guidance/hints/tips of how to do what I am trying to do.  I also said if you guys can throw in a few sample lines of code - not for my problem - but for a general problem that can help to show how to, for example, to look up a module given that I already know the unique module prefix.  The code/pseudo-code can be :

   Read in all values from Jira file and assign each value to a variable

   Then

     for linkModule in all Module do

     {

        if (linkModule == "Parent_X1_") then

           createOutLink ("Child_Y1_ 10", "Parent_X1_86")

           createOutLink ("Parent_X1_86", "Child_Y1_ 10")

    }

    What I'm looking for is the specific function names such as "createLink (childOutLink, parentInLink))" and/or the specific keywords that can help me to do that task.  Or if that function does not exist, then what are the component pieces (atomic functions) I need to know in order to create my own.  This is what I am looking for.

   Since DOORS is a domain-specific language and I 'm new to DOORS as well, I need to know IF there are any methods, functions interfaces that DOORS provides that I can use to do that task?

  I did read through DOORS DXL doc and also created some sample code to see how it works and I can tell: DXL is one heck of a language -). It's a dead language.  It's so tied down to the structure of DOORS which use Object Database (not RDBMS).  If you're new to DXL - like me - it would take you a long time to get the hang of it.  The most challenging part of all is the scope of DXL.  The code will work ONLY if it is run/executed in the scope it intends to be in and it seems to me there are no  DXL functions that I can tell DXL that this is the scope I want it to execute in.

  I'm not lazy and just want to make a short cut or an easy way out.  I did study DXL doc - for 2 weeks - but I have not gained the full understanding the architecture of DOORS and that's where I need guidance/tips/hints so that I can understand it better.

  Anyway, to cut the chase, here is the problem I try to solve:

1 - DOORS has a parent module "Parent_X" that links to a child module "Child_Y_".

2 - In parent module "Parent_X", there are members "Parent_X__1", "Parent_X_2", ..., "Parent_X_n"

3 - "Parent_X_1" has two children "Child_Y_1" and "Child_Y_2"

      Example:

                   Parent_X_1 <-> Child_Y_1

                   Parent_X_1 <-> Child_Y_2

4 - Now have a  new child Y from Jira, in CSV format which contains child Y and  all the information about its parent X.  Note that this child does not already exist in DOORS and it needs DOORS to designate an ID (Object Identifier) for it.

   

     Object Identifier     Object Text            Parent ID                  Parent Module Prefix    Child Module Prefix

                                     As Admin...etc         Parent_X_1               Parent_X_                          Child_Y_

 

5 - I'd like to write a DOOR DXL program to:

     - Create a new child object Y where it belong to module "Child_Y"

    -  Once Doors create a new child Y, and designate a new Object Identifier, let say, "Child_Y_3" then

    - From "Child_Y_3', create an outlink to "Parent_X_1" where the parent's module is  "Parent_X_"

    - From "Parent_X_1", create an outlink to child "Child_Y_3" where the child's module is "Child_Y_"

6 - I'd like to initiate the  execution as mentioned above, when I select the CSV file for import.

 Question:  Given the modules relationship specified in the import file, is that possible to tell DXL to build those relationships/links by itself?  And how to kick off the DXL scripts at the import layer?  Or what is the best way to do this?

Thanks for the guidance/tips/hints.  Where in the DXL docs,  can I look up some methods that can help me to do just that?

Again, I'm technically capable to sort these out by myself.  I only need experienced folks like you guys to point me to the right directions.  That will save me a great deal of time to digest this crazy, ugly, obnoxious , domain-specific language.  In other words, please show me the water, I'll drink it myself.

  Thanks again for taking your time to respond to my inquiry and feel free correct me if my understanding of DXL is incorrect.  I'm all ears.  Please help!

  Regards,

  John Nguyen

    

 

 



 

 

 

 

 

 

Hi John,

I understand that it is quite difficult to get started with DXL, especially if you have not worked with the DOORS GUI for some time, but this essential for writing DXL scripts. From your description, it seems that you do not have worked too much with DOORS, hence the wording you use is a bit vague and does not easily translate to DOORS words, it also seems that there are some misunderstandings about how the DOORS data model works, how identifiers work, how objects are linked.

One has to be quite exact, otherwise the script will not be easy to write.

Forgive me if you already know everything I state here, but I was a bit confused when reading your description.

Also, forgive me if you are confused after having read my description :)

 

Some words before: 

- Modules doh't have children, they have Objects. Objects may have children, but this refers to the chapter structure (promote/demote). The child of an Object is again an Object.

- Modules don't have links, Objects have links. Modules only have (optional) link restrictions, which say something like "whenever a link is created from one object inside this module, it must go to one of these destination modules and it must use this or that link Module.

- Objects have links, a link goes from one object to another. When you create a Link from object Y1 to object X2, then Y1 has an "out link" to X2, and X2 has an "in link" from Y1, that is the same thing seen from the other direction. In DXL, a Link is always created from the starting point, so in this example, it is created in module Y, you need an (exclusive) Edit session for Y and a Read session for X.

- Links have a meaning like "this requirement refines that requirement". These meanings are expressed by the name of the link module. So, you could have a link "Y2 refines X1" (i.e. a link exists from Y2 to X1 going through the link module "refines") and the same time you can have a link "Y2 is part of assembly A9" (i.e. a link exists from Y2 to A9 going through the link module "is part of").

- Objects have a special attribute "Absolute Number". This attribute is created and filled automatically at once, whenever you create an object. The "identifier" of an object is a combination of the Module's attribute "Prefix" and the Object's attribute "Absolute Number".

 

So, from your words, I understood the following:

You have two modules residing in some folder in some project.

These modules have the names "Parent_X" and "Child_Y". These modules have module prefixes, "Parent_X_" and "Child_Y_", respectively. 

"Parent_X" only contains high level reqs, "Child_y" only contains low level reqs.

You have a link module called "refines" which resides in the same directory as Parent_X and Child_Y

There is no chapter structure in Parent_X nor in Child_Y, all objects are just plain lists, one after the other

There is a link restriction already set up, or at least there is only one kind of link direction wanted, it's the "refines" relationship, only links from Child_Y are created and all links go to module "Parent_X"

Your CSV file does not contain an ID for the Objects in Module Y, it is OK to use the automatically created "Absolute Number"

Your CSV files knows the absolute numbers of the Objects in Module X.

 

You have the use case "check whether the object for Y" already exists and if not "create a new object in Y, check whether the object in X exists and if so, create a link from the new object in Y to the object in X".

 

 

Given this, you have something like the following code (assuming you have no filters set in both modules)

 

- Open X in read mode (Module mX = read (...))

- Open Y in edit mode (Module mY = edit (...))

- open the CSV file

- read the second line (if the first contains the headings), split the line into variables. split identifiers like "Parent_X_1", so that you have the number 1 in a variable.

- check whether the object 1 in X exists

Object oInX = object (1,mX)
if !null oInX then...

- now, checking whether the object in Y of line 2 already exists might be quite difficult, Perhaps you need a loop like

string searchMe = <object text of object from csv file>
Object o
bool found = false
for o in entire mY do {
    if o."Object Text""" == searchMe then {
        found = true
        break
    }
}

- when you have to create an object, the question is where to create it. Perhaps you can use 

Object oNewInY = create last mY

(see the create object command in dxl manual)

Then you set the attributes like

oNewInY."Object Text" = searchMe

- For  creating Links, use the command "->" like

oInY -> "refines" -> oInX

- there are commands "save mY" and "close mY"

Perhaps this gives you a start...

Re: Newbie on the block needs guidance
RFT_Newbie - Fri Jun 08 22:27:58 EDT 2018

Mike.Scharnow - Fri Jun 08 19:50:13 EDT 2018

Hi John,

I understand that it is quite difficult to get started with DXL, especially if you have not worked with the DOORS GUI for some time, but this essential for writing DXL scripts. From your description, it seems that you do not have worked too much with DOORS, hence the wording you use is a bit vague and does not easily translate to DOORS words, it also seems that there are some misunderstandings about how the DOORS data model works, how identifiers work, how objects are linked.

One has to be quite exact, otherwise the script will not be easy to write.

Forgive me if you already know everything I state here, but I was a bit confused when reading your description.

Also, forgive me if you are confused after having read my description :)

 

Some words before: 

- Modules doh't have children, they have Objects. Objects may have children, but this refers to the chapter structure (promote/demote). The child of an Object is again an Object.

- Modules don't have links, Objects have links. Modules only have (optional) link restrictions, which say something like "whenever a link is created from one object inside this module, it must go to one of these destination modules and it must use this or that link Module.

- Objects have links, a link goes from one object to another. When you create a Link from object Y1 to object X2, then Y1 has an "out link" to X2, and X2 has an "in link" from Y1, that is the same thing seen from the other direction. In DXL, a Link is always created from the starting point, so in this example, it is created in module Y, you need an (exclusive) Edit session for Y and a Read session for X.

- Links have a meaning like "this requirement refines that requirement". These meanings are expressed by the name of the link module. So, you could have a link "Y2 refines X1" (i.e. a link exists from Y2 to X1 going through the link module "refines") and the same time you can have a link "Y2 is part of assembly A9" (i.e. a link exists from Y2 to A9 going through the link module "is part of").

- Objects have a special attribute "Absolute Number". This attribute is created and filled automatically at once, whenever you create an object. The "identifier" of an object is a combination of the Module's attribute "Prefix" and the Object's attribute "Absolute Number".

 

So, from your words, I understood the following:

You have two modules residing in some folder in some project.

These modules have the names "Parent_X" and "Child_Y". These modules have module prefixes, "Parent_X_" and "Child_Y_", respectively. 

"Parent_X" only contains high level reqs, "Child_y" only contains low level reqs.

You have a link module called "refines" which resides in the same directory as Parent_X and Child_Y

There is no chapter structure in Parent_X nor in Child_Y, all objects are just plain lists, one after the other

There is a link restriction already set up, or at least there is only one kind of link direction wanted, it's the "refines" relationship, only links from Child_Y are created and all links go to module "Parent_X"

Your CSV file does not contain an ID for the Objects in Module Y, it is OK to use the automatically created "Absolute Number"

Your CSV files knows the absolute numbers of the Objects in Module X.

 

You have the use case "check whether the object for Y" already exists and if not "create a new object in Y, check whether the object in X exists and if so, create a link from the new object in Y to the object in X".

 

 

Given this, you have something like the following code (assuming you have no filters set in both modules)

 

- Open X in read mode (Module mX = read (...))

- Open Y in edit mode (Module mY = edit (...))

- open the CSV file

- read the second line (if the first contains the headings), split the line into variables. split identifiers like "Parent_X_1", so that you have the number 1 in a variable.

- check whether the object 1 in X exists

Object oInX = object (1,mX)
if !null oInX then...

- now, checking whether the object in Y of line 2 already exists might be quite difficult, Perhaps you need a loop like

string searchMe = <object text of object from csv file>
Object o
bool found = false
for o in entire mY do {
    if o."Object Text""" == searchMe then {
        found = true
        break
    }
}

- when you have to create an object, the question is where to create it. Perhaps you can use 

Object oNewInY = create last mY

(see the create object command in dxl manual)

Then you set the attributes like

oNewInY."Object Text" = searchMe

- For  creating Links, use the command "->" like

oInY -> "refines" -> oInX

- there are commands "save mY" and "close mY"

Perhaps this gives you a start...

Mike,

  Thanks again for going great pain to walk me through this jungle.  You nailed what I wanted to do.  Yes, I have not worked with DOORS GUI at all.  I learnt it because I have a task to interact with it.  And yes there are some misunderstanding - on my part - of module linkage .

  This is a great start for me.  I'll pick this up from here.  Now I have a better understanding of Modules.

  You're good man Mike! :-).

  Thanks again and have a good weekend!

  John Nguyen

Re: Newbie on the block needs guidance
Mike.Scharnow - Sun Jun 10 10:46:25 EDT 2018

RFT_Newbie - Fri Jun 08 22:27:58 EDT 2018

Mike,

  Thanks again for going great pain to walk me through this jungle.  You nailed what I wanted to do.  Yes, I have not worked with DOORS GUI at all.  I learnt it because I have a task to interact with it.  And yes there are some misunderstanding - on my part - of module linkage .

  This is a great start for me.  I'll pick this up from here.  Now I have a better understanding of Modules.

  You're good man Mike! :-).

  Thanks again and have a good weekend!

  John Nguyen

good luck. The usual reminder: remember to test every single script in a test database where it does not matter if you accidentally delete any data :)

 

And: remember to tell your boss that when he assigns the the next DXL script task to you that he shall also assign some time to you first to become a DOORS expert, as DXL is not just a programming language, rather a facility to ease the work for DOORS administrators :)

Re: Newbie on the block needs guidance
RFT_Newbie - Wed Jun 13 23:07:31 EDT 2018

Mike.Scharnow - Sun Jun 10 10:46:25 EDT 2018

good luck. The usual reminder: remember to test every single script in a test database where it does not matter if you accidentally delete any data :)

 

And: remember to tell your boss that when he assigns the the next DXL script task to you that he shall also assign some time to you first to become a DOORS expert, as DXL is not just a programming language, rather a facility to ease the work for DOORS administrators :)

Hi Mike,

  I  made some progress ;-) here.  Was able to read in an external csv file, one line at a time (skip the column header as you mentioned) and set them to a lousy-named "Skip" ( who  the heck came up  with this data structure name?  you call this data structure "Skip"? but in fact you did not skip anything , you actually store the reading input into your "Skip"?  What kind of weed you smoke?  I need some of those :-)) and one thing that threw me off is that: within a cell, if there is a new line character "\n", then the reader treats the "\n" as a comma and therefore it breaks the contents of a cell into multiple lines.  I looked at each line before I split  each field  and save them to the "Skip" and I saw that the reader did put the double quotes around the text in each cell.  So it does the right thing, but then it reads into the text line between the double quotes.  I believe this is a bug - a big bug.

  Now I will have to write a python program to clean out the "\n" in all cells so that the file reader won't treat them ("\n") as a comma delimiter.

  Will keep you update of my progress as I tackle this task.

  Again I really appreciate your guidance and advice.

  John Nguyen

PS: God, please save my soul!  I've never seen such an ugly, nasty, lousy language as DXL. 

Re: Newbie on the block needs guidance
RFT_Newbie - Sat Jun 30 18:41:05 EDT 2018

RFT_Newbie - Wed Jun 13 23:07:31 EDT 2018

Hi Mike,

  I  made some progress ;-) here.  Was able to read in an external csv file, one line at a time (skip the column header as you mentioned) and set them to a lousy-named "Skip" ( who  the heck came up  with this data structure name?  you call this data structure "Skip"? but in fact you did not skip anything , you actually store the reading input into your "Skip"?  What kind of weed you smoke?  I need some of those :-)) and one thing that threw me off is that: within a cell, if there is a new line character "\n", then the reader treats the "\n" as a comma and therefore it breaks the contents of a cell into multiple lines.  I looked at each line before I split  each field  and save them to the "Skip" and I saw that the reader did put the double quotes around the text in each cell.  So it does the right thing, but then it reads into the text line between the double quotes.  I believe this is a bug - a big bug.

  Now I will have to write a python program to clean out the "\n" in all cells so that the file reader won't treat them ("\n") as a comma delimiter.

  Will keep you update of my progress as I tackle this task.

  Again I really appreciate your guidance and advice.

  John Nguyen

PS: God, please save my soul!  I've never seen such an ugly, nasty, lousy language as DXL. 

Mike,

  After many trials and errors I finally nailed it.

  I really appreciate that you show the horse where the water is.  The horse is able to drink the water himself :-).

  You're good man Mike.

  Have a good week-end, Mike!

  John Nguyen

  PS: No surprised that IBM decided to kill DXL.  It is really a worse language that I know of.